<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Courses extends CI_Controller {

	/**
	 * Index Page for this controller.
	 *
	 * Maps to the following URL
	 * 		http://example.com/index.php/welcome
	 *	- or -  
	 * 		http://example.com/index.php/welcome/index
	 *	- or -
	 * Since this controller is set as the default controller in 
	 * config/routes.php, it's displayed at http://example.com/
	 *
	 * So any other public methods not prefixed with an underscore will
	 * map to /index.php/welcome/<method_name>
	 * @see http://codeigniter.com/user_guide/general/urls.html
	 */
	public function __construct()
    {
        parent::__construct();
        session_start();
        $this->output->enable_profiler(FALSE);
    }
	    
	public function index()
	{
		// Nothing
	}
	
	function details($course_name)
	{
		$course_name = html_entity_decode($course_name, ENT_COMPAT, 'UTF-8');
		$course_name_rep = str_replace("-", " ", $course_name);
		$coursename = ucfirst($course_name_rep);
	    $courses = $this->MCourse->getCourseName($coursename);
		$data['main'] = 'site/course_detail';// this is using views/course_detail.php
		$data['title'] = $courses['title'];
		$data['right'] = 'site/resources_and_lecturers';
		$data['courses'] = $courses;
		$this->load->vars($data);
		$this->load->view('site/template'); 
  	}
	
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */